<template>
  <div style="padding: 10px">
    <a-button type="primary">123</a-button>
    <a-row style="margin-top: 10px" :gutter="8">
      <a-col :span="12">
        <a-card title="Java Entity">
          <a-textarea v-model:value="value" placeholder="请输入Java代码" :rows="20" />
        </a-card>
      </a-col>
      <a-col :span="12">
        <a-card title="Typescript Type">{{ resultValue }}</a-card>
      </a-col>
    </a-row>
  </div>
</template>

<script setup lang="ts">
import { ref, watch } from 'vue'

const value: string = ref('private String name;private int age;private boolean isActive;')
const resultValue: string[] = ref([])

watch(
  value,
  () => {
    const pattern = /private\s+\w+\s+(\w+);/g
    var matches = value.value.match(pattern)
    resultValue.value = router.getMatchedComponents()
  },
  {
    immediate: true
  }
)
</script>

<style scoped></style>
